package cn.kys.modules.system.service.mapper;

import cn.kys.common.base.BaseMapper;
import cn.kys.modules.system.domain.User;
import cn.kys.modules.system.service.dto.UserDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;

/**功能描述：用户实体映射
 * @Auther:http://www.kys.cn
 * @Date:2020/3/28
 * @Description:cn.kys.modules.system.service.mapper
 * @version:1.0
 */
@Mapper(componentModel = "spring",uses = {RoleMapper.class, DeptMapper.class, JobMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)//未映射的目标属性被忽略
public interface UserMapper extends BaseMapper<UserDto, User> {

    /**
     * 转换
     * @param user 原始数据
     * @return /
     */
    @Override
    @Mapping(source = "user.userAvatar.realName",target = "avatar")
    UserDto toDto(User user);
}
